package com.matuw.android.adapter.dataset;


import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.matuw.android.adapter.UniversalAdapter;

import java.util.Collection;
import java.util.List;


/**
 * 具有保存数据能力的 adapter 扩展
 *
 * @param <T>
 * @date 2022/1/19
 */
public interface AdapterDataSet<T> {

    boolean contains(T o);

    boolean isEmpty();

    int size();

    void setAll(Collection<? extends T> c);

    boolean add(T t);

    boolean add(T t, boolean notify);

    boolean remove(T o);

    boolean remove(T o, boolean notify);

    boolean addAll(Collection<? extends T> c);

    boolean addAll(Collection<? extends T> c, boolean notify);

    boolean addAll(int index, Collection<? extends T> c);

    boolean addAll(int index, Collection<? extends T> c, boolean notify);

    boolean removeAll(Collection<? extends T> c);

    boolean removeAll(Collection<? extends T> c, boolean notify);

    void clear();

    void clear(boolean notify);

    T get(int index);

    @Nullable
    T getOrNull(int index);

    T set(int index, T element);

    T set(int index, T element, boolean notify);

    void add(int index, T element);

    void add(int index, T element, boolean notify);

    T remove(int index);

    T remove(int index, boolean notify);

    int indexOf(T o);

    int lastIndex();

    List<T> getDataSet();

    void setAdapter(@NonNull UniversalAdapter<?, ?> adapter);

    @NonNull
    UniversalAdapter<?, ?> getAdapter();
}
